package com.platform.qujia.service;

import com.platform.qujia.param.request.AddPayOrderParam;
import com.platform.qujia.param.request.BankCardUpdateOrderParam;
import com.platform.qujia.param.request.PayOrderRequest;
import com.platform.qujia.pojo.*;
import com.platform.qujia.pojo.dto.carWashPaymentDto;
import com.platform.qujia.pojo.vo.POSPayOrderVO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface PayOrderService {

    //POS查询小城现金支付订单
    List<PayOrder> posSelectAppCashPayOrdersList(PayOrder payOrder);

    PayOrder selectPosPayOrderInfoByOrderRandomId(String orderRandomId);

    List<PayOrder> selectPosPayOrderListInfoByOrderRandomId(String orderRandomId);

    //查询用户的在该油企订单数量
    int selectUserOrderCount(Map<String, Object> param);

    //LNG 平台第三方订单消费余额记录
    void insertStationBalanceExchange(StationBalanceChange stationBalanceChange);

    //根据订单号查询订单
    PayOrder selectOrderInfoByOrdNo(String orderNo);

    //cherkCouponCount
    Map<String, Object> cherkCouponCount(PayOrderRequest request);

    //根据订单号查询订单
    PayOrder selectOrderInfoByMerchantsNumber(String merchantsNumber);

    //获取系统支付类型
    List<PayType> selectPayTypeList();

    //获取订单列表已转化汉字支付方式的
    List<PayOrder>  selectPayOrderListFormater(PayOrder payOrder);

    //查询POS机近七天数据
    List<Map<String, Object>> selectPosRecentlySevenData(PayOrder payOrder);

    //获取POS机昨天数据
    Map<String, Object> selectPosYesterDayData(PayOrder payOrder);

    //查询汇总数据
    List<Map> selectSum(PayOrder payOrder);

    //查询汇总数据
    Map<String, Object> selectSumTmp(PayOrder payOrder);

     //根据订单号查询订单信息
     List<PayOrder> getPayOrderList(String orderNo);

     //查询班结时间内订单
     List<PayOrder> selectPayOrderList(PayOrder payOrder);

     //查询订单信息
     PayOrder getPayOrderInfoMin(PayOrder payOrder);

     //修改订单状态
     int getUpdatePayOrder(PayOrder payOrder);


     //根据订单号查询
     PayOrder searchPayOrder(Integer orderId);

     //根据手机号查询用户信息
    List<AppUserInfo> getUserInfoByOpenId(AppUserInfo appUserInfo);

    /*
     * 根据用户openId和用户类型userType查询用户订单
     * @param payOrder
     * @return
     */
    List<PayOrder> getOrderListByOpenIdAndUserType(AppUserInfo appUserInfo);

    /*
     * 根据用户unionId查询用户订单
     * @return
     */
    List<PayOrder> getUserOrderListByUnionId(AppUserInfo appUserInfo);

    /*
     * 根据用户mobilePhone查询用户订单
     * @param appUserInfo
     * @return
     */
    List<PayOrder> getUserOrderListByMobilePhone(AppUserInfo appUserInfo);

    /*
     * 根据订单号查询订单信息和用户信息  注：此方法在随行付回调校验之后修改状态完成后
     * @param payOrder
     * @return
     */
    Map<String, Object> getOrderInfoAndUserInfoByOrderNo(PayOrder payOrder);

    /*
     * 判断该客户是否存在
     * @param customerManage
     * @return
     */
    CustomerManage isExistCustomer(CustomerManage customerManage);

    //更新客户表
    void updateCustomer(CustomerManage customerManage);

    //插入客户表
    void insertCustomer(CustomerManage customerManage);

    /*
     *  根据手机号更新客户表
     * @param customerManage
     */
    void updateCustomerByPhoneNumber(CustomerManage customerManage);

    int delOldRandomId(String orderRandomId);

    //获取订单列表
    List<POSPayOrderVO> selectPayOrderListTemp (PayOrder payOrder);

    /**
     * post机专属创建订单
     * @param param
     * @param appType 如果为null则，在费率选择的时候优先考虑微信的费率其次是支付宝，如果都没有则费率为0
     * @return
     */
    public PayOrder addPayOrder(AddPayOrderParam param,Integer appType);

    
    /**
     * post机专银行卡刷卡属创建订单
     * @param param
     * @param appType 如果为null则，在费率选择的时候优先考虑微信的费率其次是支付宝，如果都没有则费率为0
     * @return
     */
    public String bankCardAddOrder(AddPayOrderParam param,Integer appType);
    
    /**
     * 更新订单
     * @param orderSn		订单号
     * @param status		订单状态
     * @param serviceCharge	费率
     * @param commission	费额度
     * @param payDate		支付时间
     * @param receivedAmt	到账额度
     * 
     */
    public int updateTradeReverseOrder(String orderSn,String status,BigDecimal serviceCharge,Double commission,Date payDate,Double receivedAmt);
    
    /**
     * 更新订单支付时间
     * @param payDate
     * @param orderNo
     * @return
     */
    int updateOrderPayDate(Date payDate,String orderNo);
    
    /**
	 * 银行刷卡支付更新订单
	 * @param param
	 */
    public String bankCardUpdateOrder(BankCardUpdateOrderParam param);
    
    /**
     *  计算立减活动金额，返回所有该油站、油品下的活动并使用活动中优惠力度最大的活动进行抵扣金额
     * @param reductionActivitiesVO
     * @return
     */
    public BigDecimal reductionActivitiesAmountCalculation(ReductionActivitiesVO reductionActivitiesVO,String mobilePhone);
    
    public int updatePayOrder(PayOrder payOrder);

    int updatePayOrderInvoiceStatus(String orderNo, Integer invoiceStatus);

    /**
     * 创建洗车订单
     */
    PayOrder posAddCarWashOrder(PayOrder payOrder);

    int checkDzkRepeatPay(PayOrder payOrderInfo);

    PayOrder getOneBetweenCreatedDateAndCreateDesc(PayOrder payOrder);

    int updateGrowthValueByOrdNo(Long growthValue,String ordNo);

    int updateByPrimaryKeySelective(PayOrder payOrder);

    int updatePayOrderInvoiceStatusByOrdNoAndBusinessName(String orderNo,Integer invoiceStatus,String businessName);

    List<PayOrder> selectPayOrderListFormater2(PayOrder payOrder);
    List<PayOrder> selectPayOrderListFormater3(PayOrder payOrder);

    PayOrder createCashPayOrder(PayOrderRequest payOrderRequest);

    PayOrder selectByOrdNo(String orderNo);
}
